const routes = [
  {
    path: '/404',
    name: '404',
    component: () => import(/* webpackChunkName: "404" */ '@/views/404')
  },
  {
    path: '/',    
    component: () => import(/* webpackChunkName: "main" */'@/views/Main'),
    children: [
      { path: '', name: 'index', component: () => import(/* webpackChunkName: "index" */'@/views/Index') },
      {
        path: 'channel/:id/:subid?',
        name: 'channel',
        props: true,
        component: () => import(/* webpackChunkName: "channel" */'@/views/Channel')      
      }
    ]      
  },
  {
    path: '/video/:bvid+',
    name: 'video',
    props: true,
    component: () => import(/* webpackChunkName: "video" */'@/views/Video')
  },
  {
    path: '/bangumi/:id+',
    name: 'bangumi',
    props: true,
    component: () => import(/* webpackChunkName: "bangumi" */ '@/views/Bangumi')
  },
  {
    path: '/tag/:tid+',
    name: 'tag',
    props: true,
    component: () => import(/* webpackChunkName: "tag" */ '@/views/Tag')
  },
  {
    path: '/space/:mid+',
    name: 'space',
    props: true,
    component: () => import(/* webpackChunkName: "space" */ '@/views/Space')
  },
  {
    path: '/topic/:name+',
    name: 'topic',
    props: true,
    component: () => import(/* webpackChunkName: "topic" */ '@/views/Topic')
  },
  {
    path: '/vote/:vid+',
    name: 'vote',
    props: true,
    component: () => import(/* webpackChunkName: "vote" */ '@/views/Vote')
  },
  {
    path: '/article/:id+',
    name: 'article',
    props: true,
    component: () => import(/* webpackChunkName: "article" */ '@/views/Article')
  },
  {
    path: '/rank/:id?',
    name: 'rank',
    props: true,
    component: () => import(/* webpackChunkName: "rank" */ '@/views/Rank')
  },
  {
    path: '/lottery/:id?',
    name: 'lottery',
    props: true,
    component: () => import(/* webpackChunkName: "lottery" */ '@/views/Lottery')
  },
  {
    path: '/search',
    name: 'search',
    props: (route) => ({ keyword: route.query.keyword }),
    component: () => import(/* webpackChunkName: "search" */ '@/views/Search')
  },
  {
    // 找不到页面的时候的配置
    path: '*',
    name: '*',
    redirect: '/404'
  }
]

export default routes
